package com.vframework.config;

import javax.annotation.PostConstruct;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.vframework.config.freemarker.city.CityDirective;
import com.vframework.config.freemarker.dict.DictDirective;

import freemarker.template.Configuration;

@Component
public class FreeMarkerConfig {

    @Autowired
    private Configuration configuration;

    @PostConstruct
    public void setSharedVariable() {
        try {
            configuration.setSharedVariable("dict", new DictDirective());
            configuration.setSharedVariable("city", new CityDirective());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
